/*
 * @Description: 路由列表
 * @Project:
 * @Author: michelle
 * @Date: 2022-02-23 10:06:37
 * @LastEditors: Please set LastEditors
 * @lastTime: 2022-02-24 14:48:16
 * @Modified By: michelle
 * @文件相对于项目的路径: /trunkverse/src/router/routes.jsx
 */
import { useRoutes } from 'react-router-dom';

import Main from '@/layout';
import PrivateRoute from '@/components/private-route';
import Home from '@/pages/home';
import NoMatch from '@/pages/no-match';
import Task from '@/pages/task';
import Scene from '@/pages/scene';
import Map from '@/pages/map';

export default function MainRoutes() {
  const _Home = (
    <PrivateRoute
      element={Home}
      meta={{
        title: '首页',
      }}
    />
  );

  const elements = useRoutes([
    {
      path: '/',
      element: _Home,
    },
    {
      path: '/home',
      element: <Main />,
      children: [
        {
          path: 'index',
          element: _Home,
        },
        {
          path: 'scene',
          element: (
            <PrivateRoute
              element={Scene}
              meta={{
                title: '场景管理',
                // requiresAuth: true,
              }}
            />
          ),
        },
        {
          path: 'task',
          element: (
            <PrivateRoute
              element={Task}
              meta={{
                title: '任务列表',
                // requiresAuth: true,
              }}
            />
          ),
        },
        {
          path: 'map',
          element: (
            <PrivateRoute
              element={Map}
              meta={{
                title: '地图',
                // requiresAuth: true,
              }}
            />
          ),
        },
      ],
    },
    {
      path: '*',
      element: <NoMatch />,
    },
  ]);
  return elements;
}
